package net.jxtz.jxtzos.authentication.util;

import java.lang.reflect.Field;
import java.lang.reflect.Type;

public final class Objects {

    public static boolean isNull(Object object){

        if (object == null){
            return true;
        }

        Class<?> clazz = object.getClass();
        Field[] declaredFields = clazz.getDeclaredFields();
        boolean flag = true;
        for (Field declaredField : declaredFields) {
            declaredField.setAccessible(true);
            String fieldName = null;
            Object fieldValue = null;
            try {
                fieldValue = declaredField.get(object);
                Type genericType = declaredField.getGenericType();
                fieldName = declaredField.getName();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }

            if (fieldValue != null){
                flag = false;
                break;
            }
        }

        return flag;
    }

}
